package com.wtwd.campus.receiver;

import com.wtwd.campus.entity.MqLockCard;
import com.wtwd.campus.entity.MqLockDevice;
import com.wtwd.campus.service.InjectFeignService;

/**
 * @author mjy
 * @date 2022/12/29
 * @description
 */
public class SetLockCardReceiver implements Receiver {

    //    *TJ,IMEI,LOCKCARD,seq,switch,PIN,iccid,tracker _status#
    @Override
    public String parseMessage(String data) {
        String[] split = data.split(",");
        String imei = split[1];
        String commandNumber = split[3];
        String flag = split[4];
        String pin = split[5];
        String iccid = split[6];
        MqLockCard mqLockCard = new MqLockCard();
        mqLockCard.setImei(imei);
        mqLockCard.setCommandNumber(commandNumber);
        mqLockCard.setFlag(Integer.valueOf(flag));
        mqLockCard.setPin(pin);
        mqLockCard.setIccid(iccid);
        InjectFeignService.getIrmFeignClientService().setLockCardReceiver(mqLockCard);
        return imei;
    }
}
